package com.central.apps.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.central.apps.dao.TremsDao;
import com.central.apps.entity.BlTreamsdesc;
import com.central.apps.service.TremsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class TremsServiceImpl implements TremsService {

    @Autowired
    TremsDao TremsDao;



    @Override
    public String insertPuTrems(String contractnum, String tremsnum) {

        JSONObject json = new JSONObject();
        json.put("code", "0");
        json.put("msg", "条款查询完成！");

        List<BlTreamsdesc> BlTreamsdesc = quryTremsList(tremsnum);
//        for (BlTreamsdesc blTreamsdesc : BlTreamsdesc) {
//            TremsDao.insertPuTrems(contractnum,blTreamsdesc);
//        }

        json.put("data", BlTreamsdesc);
        return json.toJSONString();
    }



    @Override
    public List<BlTreamsdesc> quryTremsList(String Tremnum) {



        return TremsDao.queryTrems(Tremnum);
    }
}
